//
//  WCarouselScrollView.h
//  WCycleScrollView
//
//  Created by winter on 16/8/2.
//  Copyright © 2016年 d. All rights reserved.
//

#import <UIKit/UIKit.h>

@class WCarouselScrollView;

@protocol WCarouselScrollViewDataSource <NSObject>

@required
- (NSInteger)numberOfItemsForCarouselScrollView;
- (nullable __kindof UICollectionViewCell *)carouselScrollView:(nullable WCarouselScrollView *)wCarouselView cellForItemAtIndex:(NSInteger)index;

@end

@protocol WCarouselScrollViewDelegate <NSObject>

@optional
- (void)carouselScrollView:(nullable WCarouselScrollView *)wCarouselView didSelectItemAtIndex:(NSInteger)index;

@end

@interface WCarouselScrollView : UIView
{
    UICollectionView *_collectionView;
}

@property (nonatomic) CGSize itemSize;
@property (nonatomic, strong, nullable) UIView *backgroundView;
/** 默认 UICollectionViewScrollDirectionHorizontal */
@property (nonatomic) UICollectionViewScrollDirection scrollDirection;

@property (nonatomic, weak, nullable) id <WCarouselScrollViewDataSource> dataSource;
@property (nonatomic, weak, nullable) id <WCarouselScrollViewDelegate> delegate;

- (nullable instancetype)initWithFrame:(CGRect)frame itemSize:(CGSize)itemSize;

- (void)reloadData;

- (void)registerClass:(nullable Class)cellClass forCellWithReuseIdentifier:(nullable NSString *)identifier;
- (void)registerNib:(nullable UINib *)nibCell forCellWithReuseIdentifier:(nullable NSString *)identifier;

- (nullable __kindof UICollectionViewCell *)dequeueReusableCellWithReuseIdentifier:(nullable NSString *)identifier forIndex:(NSInteger)index;
@end
